{% extends 'car_system/base.html' %}

{% block title %}删除用户确认 - 管理后台{% endblock %}

{% block content %}
<nav aria-label="breadcrumb">
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="{% url 'home' %}">首页</a></li>
        <li class="breadcrumb-item"><a href="{% url 'admin_dashboard' %}">管理后台</a></li>
        <li class="breadcrumb-item active" aria-current="page">删除用户: {{ user_obj.username }}</li>
    </ol>
</nav>

<div class="card border-danger">
    <div class="card-header bg-danger text-white">
        <h5 class="mb-0"><i class="fas fa-exclamation-triangle me-2"></i>确认删除用户</h5>
    </div>
    <div class="card-body">
        <h4 class="mb-4">您确定要删除以下用户吗？</h4>
        
        <div class="row mb-4">
            <div class="col-md-3 text-center">
                {% if user_obj.profile.avatar %}
                <img src="{{ user_obj.profile.avatar.url }}" alt="{{ user_obj.username }}" class="rounded-circle img-thumbnail" style="width: 150px; height: 150px; object-fit: cover;">
                {% else %}
                <div class="rounded-circle bg-secondary text-white d-flex align-items-center justify-content-center mx-auto" style="width: 150px; height: 150px;">
                    <i class="fas fa-user fa-5x"></i>
                </div>
                {% endif %}
            </div>
            <div class="col-md-9">
                <h5 class="text-danger">{{ user_obj.username }}</h5>
                <div class="table-responsive">
                    <table class="table table-borderless">
                        <tbody>
                            <tr>
                                <th style="width: 150px;">用户ID:</th>
                                <td>{{ user_obj.id }}</td>
                            </tr>
                            <tr>
                                <th>电子邮件:</th>
                                <td>{{ user_obj.email }}</td>
                            </tr>
                            <tr>
                                <th>注册日期:</th>
                                <td>{{ user_obj.date_joined|date:"Y-m-d H:i" }}</td>
                            </tr>
                            <tr>
                                <th>上次登录:</th>
                                <td>{{ user_obj.last_login|date:"Y-m-d H:i" }}</td>
                            </tr>
                            <tr>
                                <th>权限:</th>
                                <td>
                                    {% if user_obj.is_superuser %}
                                    <span class="badge bg-danger">超级管理员</span>
                                    {% elif user_obj.is_staff %}
                                    <span class="badge bg-warning">管理员</span>
                                    {% else %}
                                    <span class="badge bg-secondary">普通用户</span>
                                    {% endif %}
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        
        <div class="alert alert-danger">
            <i class="fas fa-exclamation-circle me-2"></i>
            <strong>警告:</strong> 删除用户将永久删除该用户的所有数据，此操作无法撤销！
        </div>
        
        <form method="POST">
            {% csrf_token %}
            <div class="d-flex justify-content-between">
                <a href="{% url 'admin_dashboard' %}" class="btn btn-outline-secondary">
                    <i class="fas fa-arrow-left me-1"></i> 返回
                </a>
                <button type="submit" class="btn btn-danger">
                    <i class="fas fa-trash me-1"></i> 确认删除用户
                </button>
            </div>
        </form>
    </div>
</div>
{% endblock %} 